home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
-
- global proc showRendRelPanelMenu(int $show, string $menuBarLayout)
- {
- if ($show) {
- menuBarLayout -e -h 25 $menuBarLayout;
- } else {
- menuBarLayout -e -h 1 $menuBarLayout;
- }
- optionVar -intValue showRendRelPanelMenu $show;
- }
-
- global proc buildRRPeditMenu (string $editorName, string $parentMenu)
- {
- setParent -menu $parentMenu;
-
- // These should be unique enough names for the widgets for this
- // instance of the rendering rel. editor
-
- string $addItem = ($editorName + "addItem");
- string $removeItem = ($editorName + "removeItem");
- string $createSGitem = ($editorName + "createSGitem");
-
- // Check to see if we have to build the menu items
-
- if (`menu -query -numberOfItems $parentMenu` == 0)
- {
- menuItem -label "Add Items"
- -command ("lightListEditor -edit -add " + $editorName)
- $addItem;
- menuItem -label "Remove Items"
- -command ("lightListEditor -edit -remove " + $editorName)
- $removeItem;
-
- menuItem -divider true;
-
- menuItem -label "Create Shading Group"
- -command ("sets -renderable 1 -empty")
- $createSGitem;
- }
- }
-
- global proc buildRRPmodeMenu (string $editorName, string $parentMenu)
- {
- setParent -menu $parentMenu;
-
- // These should be unique enough names for the widgets for this
- // instance of the rendering rel. editor
-
- string $lightListsItem = ($editorName + "lightListsItem");
- string $shadingListsItem = ($editorName + "shadingListsItem");
-
- // Check to see if we have to build the menu items
-
- if (`menu -query -numberOfItems $parentMenu` == 0)
- {
- radioMenuItemCollection;
- menuItem -label "Lights Lists"
- -radioButton true
- -command ("lightListEditor -edit -mode lightLists " + $editorName)
- $lightListsItem;
- menuItem -label "Shading Lists"
- -radioButton true
- -command ("lightListEditor -edit -mode shadingLists " + $editorName)
- $shadingListsItem;
- }
-
- // Update radio button checks for operating mode
- string $operatingMode = `lightListEditor -query -mode $editorName`;
- menuItem -edit -radioButton ($operatingMode == "lightLists")
- $lightListsItem;
- menuItem -edit -radioButton ($operatingMode == "shadingLists")
- $shadingListsItem;
- }
-
- global proc buildRRPlistMenu (string $editorName, string $parentMenu)
- {
- setParent -menu $parentMenu;
-
- // These should be unique enough names for the widgets for this
- // instance of the rendering rel. editor
-
- string $singleSelectionItem = ($editorName + "singleSelectionItem");
- string $multiSelectionItem = ($editorName + "multiSelectionItem");
- string $allShadingGroupsItem= ($editorName + "allShadingGroupsItem");
-
- // Check to see if we have to build the menu items
-
- if (`menu -query -numberOfItems $parentMenu` == 0)
- {
- radioMenuItemCollection;
- menuItem -label "Single Selection"
- -radioButton true
- -command ("lightListEditor -edit -singleSelection " + $editorName)
- $singleSelectionItem;
- menuItem -label "Multiple Selection"
- -radioButton true
- -command ("lightListEditor -edit -multipleSelection " + $editorName)
- $multiSelectionItem;
-
- menuItem -divider true;
-
- menuItem -label "All ShadingGroups"
- -checkBox true
- -command ("lightListEditor -edit -allShadingGroups " + $editorName)
- $allShadingGroupsItem;
- }
-
- // Update radio button checks for operating mode
- int $singleSelection = `lightListEditor -query -singleSelection $editorName`;
- int $multiSelection = ! $singleSelection;
-
- menuItem -edit -radioButton $singleSelection $singleSelectionItem;
- menuItem -edit -radioButton $multiSelection $multiSelectionItem;
-
- int $allShadingGroups = `lightListEditor -query -allShadingGroups $editorName`;
- menuItem -edit -checkBox $allShadingGroups $allShadingGroupsItem;
- }
-
- global proc makeRendRelPanelMenu(string $editorName,
- string $menuBarLayoutName)
- {
- setParent $menuBarLayoutName;
-
- // These should be unique enough names for the widgets for this
- // instance of the set editor
-
- string $modeMenu = ($editorName + "modeMenu");
- string $editMenu = ($editorName + "editMenu");
- string $listMenu = ($editorName + "listMenu");
-
- menu -label "Mode" -tearOff true -aob true $modeMenu;
- menu -edit -postMenuCommand ("buildRRPmodeMenu " + $editorName + " " + $modeMenu) $modeMenu;
- setParent -menu ..;
-
- menu -label "Edit" -tearOff true $editMenu;
- menu -edit -postMenuCommand ("buildRRPeditMenu " + $editorName + " " + $editMenu) $editMenu;
- setParent -menu ..;
-
- menu -label "List" -tearOff true $listMenu;
- menu -edit -postMenuCommand ("buildRRPlistMenu " + $editorName + " " + $listMenu) $listMenu;
- setParent -menu ..;
- }
-
- global proc makeRendRelPanelPopupMenu(string $editorName)
- {
- string $menuPopup = ($editorName + "menuPopup");
-
- popupMenu -ctrlModifier false
- -button 3 -aob false -parent $editorName
- $menuPopup;
-
- // These should be unique enough names for the widgets for this
- // instance of the set editor
-
- string $modeMenu = ($editorName + "modePopupMenu");
- string $editMenu = ($editorName + "editPopupMenu");
- string $listMenu = ($editorName + "listPopupMenu");
-
- menuItem -label "Mode" -tearOff true -subMenu true $modeMenu;
- menuItem -edit -postMenuCommand ("buildRRPmodeMenu " + $editorName + " " + $modeMenu) $modeMenu;
- setParent -menu ..;
-
- menuItem -label "Edit" -tearOff true -subMenu true -aob true $editMenu;
- menuItem -edit -postMenuCommand ("buildRRPeditMenu " + $editorName + " " + $editMenu) $editMenu;
- setParent -menu ..;
-
- menuItem -label "List" -tearOff true -subMenu true $listMenu;
- menuItem -edit -postMenuCommand ("buildRRPlistMenu " + $editorName + " " + $listMenu) $listMenu;
- setParent -menu ..;
- }
-
-
- global proc rendRelPanel(string $panelName) {
- global string $gMainPane;
-
- // instantiate a new rendRelPanel
-
- setParent $gMainPane;
- scriptedPanel -unParent -type rendRelPanel -l $panelName $panelName;
- }
-
-
-
-
- global proc createRendRelPanel (string $whichPanel)
- //
- // Description:
- // Define the editors that are used in this panel. No
- // controls (widgets) are created at this point.
- //
- {
- // create unique names for editors based on panel name
- //
- string $rendRelEd = ($whichPanel + "RendRelEd");
- string $outlineEd = ($whichPanel + "OutlineEd");
-
- lightListEditor -unParent $rendRelEd;
-
- outlinerEditor
- -unParent
- -mainListConnection worldList
- -selectionConnection modelList
- $outlineEd;
- }
-
- global proc addRendRelPanel (string $whichPanel)
- //
- // Description:
- // Add the panel to a layout.
- // Parent the editors to that layout and create any other
- // controls (widgets) required.
- //
- {
- string $rendRelEd = ($whichPanel + "RendRelEd");
- string $outlineEd = ($whichPanel + "OutlineEd");
-
- waitCursor -state on;
-
- string $fl = `frameLayout -bv 0 -lv 0 rreFrameLayout`;
- string $pl = `paneLayout -configuration "vertical2" -ps 1 35 100 rrePaneLayout`;
-
- // Parent the editors to the editor layout
- //
- outlinerEditor -edit -parent $pl $outlineEd;
- lightListEditor -edit -parent $pl $rendRelEd;
-
-
-
- // Make the menus
- string $menuBarLayoutName = `scriptedPanel -q -control $whichPanel`;
- string $formLayoutName = `formLayout`;
-
- if (`optionVar -exists showRendRelPanelMenu`) {
- showRendRelPanelMenu
- (`optionVar -query showRendRelPanelMenu`) $menuBarLayoutName;
- }
- // Attach the menus to the menu form
- makeRendRelPanelMenu $rendRelEd $menuBarLayoutName;
-
-
- // Attach the popup menu to the editor
- makeRendRelPanelPopupMenu $rendRelEd;
-
- setParent -top;
- waitCursor -state off;
- }
-
- global proc removeRendRelPanel (string $whichPanel)
- //
- // Description:
- // Remove the panel from a layout.
- // Delete controls.
- //
- {
- string $rendRelEd = ($whichPanel + "RendRelEd");
- string $outlineEd = ($whichPanel + "OutlineEd");
-
- if (`outlinerEditor -exists $outlineEd`) {
- outlinerEditor -edit -unParent $outlineEd;
- }
- if (`lightListEditor -exists $rendRelEd`) {
- lightListEditor -edit -unParent $rendRelEd;
- }
- }
-
- global proc deleteRendRelPanel (string $whichPanel)
- //
- // Description:
- // This proc will delete the contents of the panel, but not
- // the panel itself.
- //
- // Note:
- // We only need to delete editors here. Other UI will be taken care of
- // by the remove proc.
- //
- {
- string $rendRelEd = ($whichPanel + "RendRelEd");
- string $outlineEd = ($whichPanel + "OutlineEd");
-
- if (`lightListEditor -exists $rendRelEd`) {
- deleteUI -editor $rendRelEd;
- }
- if (`outlinerEditor -exists $outlineEd`) {
- deleteUI -editor $outlineEd;
- }
- }
-
- global proc string saveStateRendRelPanel (string $whichPanel)
- //
- // Description:
- // This proc returns a string that when executed will restore the
- // current state of the panel elements.
- //
- {
- string $indent = "\n\t\t\t";
- string $rendRelEd = ($whichPanel + "RendRelEd");
- string $outlineEd = ($whichPanel + "OutlineEd");
-
- return (
- $indent + "$editorName = ($panelName+\"OutlineEd\");\n" +
- `outlinerEditor -query -stateString $outlineEd` + ";\n" +
- $indent + "$editorName = ($panelName+\"RendRelEd\");\n" +
- `lightListEditor -query -stateString $rendRelEd`
- );
- }
-
-
- global proc addToRREpanel(string $whichPanel) {
- frameLayout -bv 0 -lv 0 rreFrameLayout;
- paneLayout -configuration "vertical2" -ps 1 35 100 rrePaneLayout;
-
- outlinerEditor -mainListConnection worldList -selectionConnection modelList outEd;
- lightListEditor renderingRelEditor;
- }
-